% File: testbench_sc_fde_ib_evolution.m
% -------------------------------------
% This script tests snr vs var evolution characteristics based on channel
% realization.

close all
clear all

% dbstop in sc_fde_ib_snr_evolution at 46
% dbstop in sc_fde_ib at 49
% dbstop in sc_fde_ib at 36
dbstop in sc_fde_ib at 84

% dbstop in sc_fde_ib_tone at 103

load testbench_sc_fde_ib_evolution.mat

% -------------------------------------------------------------------------
% test point - mse, var buffer
% -------------------------------------------------------------------------
mse_buffer      = zeros(length(SNR),5,nsubf); % buffering mse calculate, 5 iterations
mse_test_buffer = zeros(size(mse_buffer));
var_buffer      = zeros(size(mse_buffer));
var_test_buffer = zeros(size(mse_buffer));
% -------------------------------------------------------------------------

sc_fde_ib
% sc_fde_ib_tone

% -------------------------------------------------------------------------
% test point - snr = 1/mse
% -------------------------------------------------------------------------
SNR_BUF  = 1./mse_buffer;
SNR_TBUF = 1./mse_test_buffer;
% -------------------------------------------------------------------------

% -------------------------------------------------------------------------
% test point - plot
% -------------------------------------------------------------------------
load testbench_sc_fde_ib_evolution_buf.mat

figure();
semilogx(var_buffer, SNR_BUF, '-.p');
set(gca,'XDir','reverse')
xlabel('Average Variance'); ylabel('SNR');
grid on
legend('Trace Algo.', 'Location', 'SouthEast');
title('Evolutional Chart of Iterative Process');

figure();
semilogx(var_test_buffer, SNR_TBUF, '-.p');
set(gca,'XDir','reverse')
xlabel('Average Variance'); ylabel('SNR');
grid on
legend('Trace Test', 'Location', 'SouthEast');
title('Evolutional Chart of Iterative Process');
% -------------------------------------------------------------------------

% End of script.